#ifndef CUTIL_H
#define CUTIL_H

#include "preheader.h"

/**
    @file cutil.h
    @brief Global string and number definitions which configurate the program.
    @author Claus Wimmer
    @date 2014-01-04

    Project: secondspace
    Licence: LGPL (Lesser GPL)
*/
class CUtil : public QObject {

    Q_OBJECT

public:

    /**
        @brief Numeric constant to chose the rendering mode.
        @author Claus Wimmer
        @date 2014-01-04
     */
    enum MODUS { MODUS_0 = 0, MODUS_1 = 1, MODUS_2 = 2 };

    /**
        @brief Read Qss stylesheet from file.
        @author Claus Wimmer
        @date 2012-10-05
        @return The Qss as a string.
    */
    static QString qss();

    /**
        @brief Show a console message.
        @author Claus Wimmer
        @date 2012-10-05
        @param msg The text of the message.
    */
    static void showMessage(QString msg);

    /**
        @brief Copy a file to another path in the file system.
        @author Claus Wimmer
        @date 2012-10-05
        @param srcpath Copy from (file remains).
        @param dstpath Copy to (a second file appears).

        Copy only if destination does not exist.
    */
    static void copyFile(QString srcpath, QString dstpath);

    /**
        @brief Create a directory and parents that not exist so far.
        @author Claus Wimmer
        @date 2012-10-05
        @param dirpath Pathname a string.

        Copy only if destination does not exist.
    */
    static void mkpath(QString dirpath);

    /**
        @brief Copy all config files from binary to a new to create config dir.
        @author Claus Wimmer
        @date 2012-10-05

        Only done if the config dir not exists.
    */
    static void provideConfigDir();

    /**
        @brief Converts file content to a char array.
        @author Claus Wimmer
        @date 2012-10-05
        @param filepath Which file to read.
        @param len Returns the length of the character array.
        @return File content as character array.

        Receiver has do delete the new created buffer ("delete[]");
    */
    static char *fileBytes(QString filepath, size_t *len);

    /**
        @brief Save a screenshot - like image of the space as PNG.
        @author Claus Wimmer
        @date 2012-10-05
        @param image Content of the image.
        @param fileindex Increased numerical index built in into the filename.

        Saved to the output/ dir within the config dir.
    */
    static void saveImageFile(QImage *image, uint fileindex);

    /**
        @brief Delete old screenshot images during program start.
        @author Claus Wimmer
        @date 2012-10-05
    */
    static void clearImageDirectory();

    /**
        @brief Path of the config dir.
        @author Claus Wimmer
        @date 2012-10-05

        Either $HOME/secondspace/ of a path specified at the command line.
    */
    static QString configdir;

    /**
        @brief Config file version specified there.
        @author Claus Wimmer
        @date 2012-10-05
    */
    static QString version;

    /**
        @brief Path of the outputdir relative to the config dir.
        @author Claus Wimmer
        @date 2012-10-05
    */
    static QString outputdir;

    /**
        @brief Path of the temporary dir relative to the config dir.
        @author Claus Wimmer
        @date 2012-10-05
    */
    static QString tmpdir;

    /**
        @brief Filename of the include header used by the kernel files.
        @author Claus Wimmer
        @date 2013-07-25
    */
    static const QString includekernelfile;

    /**
        @brief Filename of the init kernel relative to the config dir.
        @author Claus Wimmer
        @date 2012-10-05
    */
    static const QString initkernelfile;

    /**
        @brief Filename of the step kernel relative to the config dir.
        @author Claus Wimmer
        @date 2012-10-05
    */
    static const QString stepkernelfile;

    /**
        @brief This text appears on the title bar of the prog.
        @author Claus Wimmer
        @date 2012-10-05

        Also concatenated into the files of the screenshots.
    */
    static QString scenetitle;

    /**
        @brief Initial position of the program window on screen.
        @author Claus Wimmer
        @date 2012-10-05
    */
    static int x;

    /**
        @brief Initial position of the program window on screen.
        @author Claus Wimmer
        @date 2012-10-05
    */
    static int y;

    /**
        @brief Initial size of the program window on screen.
        @author Claus Wimmer
        @date 2012-10-05
    */
    static int width;

    /**
        @brief Initial size of the program window on screen.
        @author Claus Wimmer
        @date 2012-10-05
    */
    static int height;

    /**
        @brief Time between four space calculation steps.
        @author Claus Wimmer
        @date 2012-10-05
    */
    static int dt;

    /**
        @brief Number of calculation steps until the program stops.
        @author Claus Wimmer
        @date 2012-10-05
    */
    static int stepcount;

    /**
        @brief Number of space pixels in x - direction.
        @author Claus Wimmer
        @date 2012-10-05
    */
    static int pixwidth;

    /**
        @brief Number of space pixels in y - direction.
        @author Claus Wimmer
        @date 2012-10-05
    */
    static int pixheight;

    /**
        @brief Maximum value of the user - controlled slider input control.
        @author Claus Wimmer
        @date 2012-10-05
    */
    static int maxslider;

    /**
        @brief Minimum value of the user - controlled slider input control.
        @author Claus Wimmer
        @date 2012-10-05
    */
    static int minslider;

    /**
        @brief Initial value of the user - controlled slider input control.
        @author Claus Wimmer
        @date 2012-10-05
    */
    static int valslider;

    /**
        @brief Number of layers of the space in Z-direction.
        @author Claus Wimmer
        @date 2013-07-16
      */
    static int layers;

    /**
        @brief Number of FLOAT variables within a single pixel in the space.
        @author Claus Wimmer
        @date 2013-07-16
      */
    static int varsiz;

    /**
        @brief Rendering mode.
        @author Claus Wimmer
        @date 2014-01-04
      */
    static int modus;

    /**
        @brief Include zoom**2 space pixels into one screen pixel.
        @author Claus Wimmer
        @date 2013-07-16
      */
    static int zoom;

    /**
        @brief Number of space calc. steps done before the next picture is rendered.
        @author Claus Wimmer
        @date 2013-07-25
      */
    static int numsteps;

    /**
        @brief Include path of kern_headers.
        @author Claus Wimmer
        @date 2013-07-25
      */
    static const QString includepath;

};
#endif // CUTIL_H
